home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / swingall.jar / javax / swing / text / rtf / RTFEditorKit.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-07-15  |  1.6 KB  |  52 lines

  1. package javax.swing.text.rtf;
  2.  
  3. import java.io.IOException;
  4. import java.io.InputStream;
  5. import java.io.OutputStream;
  6. import java.io.Reader;
  7. import java.io.Writer;
  8. import javax.swing.text.BadLocationException;
  9. import javax.swing.text.Document;
  10. import javax.swing.text.StyledDocument;
  11. import javax.swing.text.StyledEditorKit;
  12.  
  13. public class RTFEditorKit extends StyledEditorKit {
  14.    public Object clone() {
  15.       return new RTFEditorKit();
  16.    }
  17.  
  18.    public String getContentType() {
  19.       return "text/rtf";
  20.    }
  21.  
  22.    public void read(InputStream var1, Document var2, int var3) throws IOException, BadLocationException {
  23.       if (var2 instanceof StyledDocument) {
  24.          RTFReader var4 = new RTFReader((StyledDocument)var2);
  25.          ((AbstractFilter)var4).readFromStream(var1);
  26.          var4.close();
  27.       } else {
  28.          super.read(var1, var2, var3);
  29.       }
  30.  
  31.    }
  32.  
  33.    public void read(Reader var1, Document var2, int var3) throws IOException, BadLocationException {
  34.       if (var2 instanceof StyledDocument) {
  35.          RTFReader var4 = new RTFReader((StyledDocument)var2);
  36.          ((AbstractFilter)var4).readFromReader(var1);
  37.          var4.close();
  38.       } else {
  39.          super.read(var1, var2, var3);
  40.       }
  41.  
  42.    }
  43.  
  44.    public void write(OutputStream var1, Document var2, int var3, int var4) throws IOException, BadLocationException {
  45.       RTFGenerator.writeDocument(var2, var1);
  46.    }
  47.  
  48.    public void write(Writer var1, Document var2, int var3, int var4) throws IOException, BadLocationException {
  49.       throw new IOException("RTF is an 8-bit format");
  50.    }
  51. }
  52.